
/** 用户相关的数据库操作举例
 * 全项目所有有关数据库的操作都只能在数据库模型（models）下存在
*/

const mysqlLoader = require('../loaders/mysql');
module.exports = userModel = (uid) => {
    return new Promise((resolve, reject) => {
        mysqlLoader().then(pool => {
            let sql = `select nick from user where uid = ${uid}`;
            pool.query(sql, [], function (error, results, fields) {
                if (error) {
                    rejec(error)
                }
                if (results) {
                    resolve(results)
                }
            });
        })
    })
}